Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(witness): use block executor to execute block inside debug_execution_witness #10736

Conversation

0x00101010
Copy link
Contributor

@0x00101010 0x00101010 commented Sep 5, 2024

Description

The code does the following:

  1. allow passing BlockExecutorProvider to RpcModuleBuilder and eventually passed down to DebugApi initialization
  2. rework debug_execution_witness API to use block_executor to execute blocks.

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to start with integrating the block executor into the debug_executionWitness rpc, and then debugging. Is the assert failing due to changes in this PR or does it also occur on main? If it occurs on main, definitely submit an issue and we can focus on it there

crates/ethereum/evm/src/execute.rs Outdated Show resolved Hide resolved
crates/rpc/rpc/src/debug.rs Outdated Show resolved Hide resolved
@0x00101010
Copy link
Contributor Author

@Rjected here's the issue: #10756

@0x00101010 0x00101010 force-pushed the debug_execution_wintess/block_executor branch from a0d6885 to 0ef0198 Compare September 6, 2024 21:39
@0x00101010 0x00101010 force-pushed the debug_execution_wintess/block_executor branch from a7c10ee to be600b0 Compare September 6, 2024 23:29
@0x00101010 0x00101010 force-pushed the debug_execution_wintess/block_executor branch 2 times, most recently from ed3c527 to abc3d60 Compare September 9, 2024 17:56
@0x00101010 0x00101010 marked this pull request as ready for review September 9, 2024 18:11
@0x00101010 0x00101010 requested a review from Rjected September 9, 2024 18:12
@rkrasiuk
Copy link
Member

rkrasiuk commented Sep 9, 2024

@mattsse thoughts on adding executor factory to rpc?

@0x00101010 0x00101010 force-pushed the debug_execution_wintess/block_executor branch 7 times, most recently from 511b84f to 40a9310 Compare September 11, 2024 21:22
@mattsse
Copy link
Collaborator

mattsse commented Sep 12, 2024

@mattsse thoughts on adding executor factory to rpc?

that makes sense, I assume this could be useful and we could extend this functionality and use this as the entrypoint to abstract execution in rpc in general

Comment on lines 65 to 67
fn state_ref(&self) -> &State<DB> {
todo!()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this now bakes in the state into the executor interface, I don't want to do this

@@ -50,7 +51,7 @@ impl<DB> Executor<DB> for MockExecutorProvider {
type Output = BlockExecutionOutput<Receipt>;
type Error = BlockExecutionError;

fn execute(self, _: Self::Input<'_>) -> Result<Self::Output, Self::Error> {
fn execute(&mut self, _: Self::Input<'_>) -> Result<Self::Output, Self::Error> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this necessary?

@0x00101010 0x00101010 force-pushed the debug_execution_wintess/block_executor branch 3 times, most recently from 0b38792 to f4a5f2c Compare September 14, 2024 00:07
Copy link
Member

@emhane emhane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice with a test for DebugApi::debug_execution_witness, however possibly running hive tests for this branch would be enough before merging? wdyt @Rjected ?

Comment on lines 619 to 647
// for (address, account) in bundle_state.state {
// let hashed_address = keccak256(address);
// hashed_state.accounts.insert(
// hashed_address,
// account.account.as_ref().map(|a| a.info.clone().into()),
// );

// let storage = hashed_state
// .storages
// .entry(hashed_address)
// .or_insert_with(|| HashedStorage::new(account.status.was_destroyed()));

// if let Some(account) = account.account {
// if include_preimages {
// state_preimages
// .insert(hashed_address, alloy_rlp::encode(address).into());
// }

// for (slot, value) in account.storage {
// let slot = B256::from(slot);
// let hashed_slot = keccak256(slot);
// storage.storage.insert(hashed_slot, value);

// if include_preimages {
// state_preimages.insert(hashed_slot,
// alloy_rlp::encode(slot).into()); }
// }
// }
// }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should remove this before marking pr ready for review, else mark pr as draft

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry should've changed it to draft before pushing the latest change.

There were further discussion offline regarding the latest update, I'll rework the code to reflect them.

@0x00101010 0x00101010 marked this pull request as draft September 16, 2024 16:16
@0x00101010 0x00101010 force-pushed the debug_execution_wintess/block_executor branch from f4a5f2c to c256876 Compare September 23, 2024 23:36
@0x00101010 0x00101010 closed this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants